export function getSetting (auth, onSuccess, onFail) {
  mpvue.getSetting({
    success (res) {
    //  console.log(res)
      if (res.authSetting[`scope.${auth}`]) {
        onSuccess(res)
      } else {
        onFail(res)
      }
    },
    fail (res) {
      console.log(res)
    }
  })
}
export function getUserInfo (onSuccess, onFail) {
// 必须是在用户已经授权的情况下调用
  mpvue.getUserInfo({
    success (res) {
      var userInfo = res.userInfo
      if (userInfo) {
        onSuccess(userInfo)
      } else {
        onFail(res)
      }
    },
    fail (res) {
      console.log(res)
    }
  })
}

export function getStorageSync (key) {
  return mpvue.getStorageSync(key)
}

export function setStorageSync (key, data) {
  mpvue.setStorageSync(key, data)
  // const wx = () => {
  //   mpvue.setStorageSync(key, data)
  // }
  // const my = () => {
  //   mpvue.setStorageSync(key, data)
  // }
  // adapter({ wx, my })
}
